<template>
    <view :style="themeColor">
        <view class="page" >
    <view class="flex benben-position-layout flex flex-wrap align-center commoDity_flex_0"    :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
            <view   class='flex flex-wrap align-center justify-between flex-sub commoDity_fd0_0'      >
            <view   class='flex flex-wrap align-center'   @tap.stop="handleJumpDiy" data-type="back" data-url="1"   >
        <text class='fu-iconfont2  commoDity_fd0_0_c0_c0'  >&#xE794;</text>
</view>
    <view   class='flex flex-wrap align-center'      >
        <text class='commoDity_fd0_0_c0_c0'  >{{$t('商品详情')}}</text>
</view>
    <view   class='flex flex-wrap align-center commoDity_fd0_0_c2'      >
        </view>
</view>

        </view>
<view :style="{height: (88+StatusBarRpx)+'rpx'}"  ></view>
<!---轮播flex布局开始-->
 <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout commoDity_flex_1"    >
        <view style="position: relative" >
    <swiper ref="benbenSwiperfd1_0" :current='index' @change="bannerIndexfd1_0 = $event.detail.current" class='flex position-relative commoDity_fd1_0'  previous-margin="0rpx" next-margin="0rpx" :display-multiple-items="1" :interval="5000" :duration="500" :autoplay='true' :circular='true' >
        
    <template v-for = '(item,key0) in dataDetails.images'>
        <swiper-item class='flex  commoDity_fd1_0'        :key='key0'>
        <image class='commoDity_fd1_0_c1_c0'  mode="aspectFill"  :src='item' @tap.stop="multiImagePreview(item,dataDetails.images,'')" ></image>
</swiper-item>
    </template>

    </swiper>
    <view style="position: absolute" class="flex dot flex align-center justify-center commoDity_swiperDotfd1_0" >
            <view   class='flex flex align-center justify-center commoDity_numberfd1_0_c0'      >
        <text class='commoDity_numberfd1_0_c0_c0'  >{{bannerIndexfd1_0+1}}</text>
<text class='commoDity_numberfd1_0_c0_c0'  >/</text>
<text class='commoDity_numberfd1_0_c0_c2'  >{{(dataDetails.images.length)}}</text>
</view>

    </view>
</view>
    <view   class='flex align-center commoDity_fd1_1'    v-if= " dataDetails.order_list.length>0"  >
        <view style="position: relative" >
    <swiper @change="bannerIndexfd1_1_c0 = $event.detail.current" class='flex position-relative commoDity_fd1_1_c0'  previous-margin="0rpx" next-margin="0rpx" :display-multiple-items="1" :vertical='true' :interval="5000" :duration="500" :autoplay='true' :circular='true' >
        
    <template v-for = '(item,key0) in dataDetails.order_list'>
        <swiper-item class='flex  commoDity_fd1_1_c0_c1'        :key='key0'>
        <text class='commoDity_fd1_1_c0_c1_c0'  >{{item.nickname}}</text>
<text class='commoDity_fd1_1_c0_c1_c1'  >刚刚购买了此商品</text>
</swiper-item>
    </template>

    </swiper>
</view>
</view>
<text class='commoDity_fd1_2'  >{{dataDetails.name}}</text>
    <view   class='flex flex-wrap align-center commoDity_fd1_3'      >
        <text class='commoDity_fd1_3_c0'  >{{dataDetails.integral}}</text>
<text class='commoDity_fd1_3_c0'    v-if= "dataDetails.shop_price!='0.00'"  >{{$t('积分+')}}</text><text class='commoDity_fd1_3_c1_1'    v-if= "dataDetails.shop_price=='0.00'"  >积分</text>
<text class='commoDity_fd1_3_c0'    v-if= "dataDetails.shop_price!='0.00'"  >{{dataDetails.shop_price}}</text>
<text class='commoDity_fd1_3_c0'    v-if= "dataDetails.shop_price!='0.00'"  >{{$t('元')}}</text>
<button class='commoDity_fd1_3_c4'  @tap.stop="goPayFunc()" v-if= " dataDetails.is_use_score=='1'" >{{$t('立即兑换')}}</button><button class='commoDity_fd1_3_c4_1'   v-if= " dataDetails.is_use_score==0" >积分不足</button>
</view>
    <view   class='flex flex-wrap align-center commoDity_fd1_4'      >
        </view>
    <view   class='flex flex-wrap align-center commoDity_fd1_5'      >
        <text class='commoDity_fd1_5_c0'  >{{$t('运费')}}</text>
<text class='commoDity_fd1_5_c1'  >{{$t('包邮')}}</text>
</view>
    <view   class='flex flex-wrap align-center commoDity_fd1_4'      >
        </view>
    <view   class='flex flex-direction flex-wrap align-stretch commoDity_fd1_7'      >
        <text class='commoDity_fd1_7_c0'  >{{$t('商品详情')}}</text>
</view>
        <jyf-parser class='commoDity_fd1_8'  :html="dataDetails.body | richTextFormat"  >
        </jyf-parser>
    <view   class='flex flex-wrap align-center justify-center commoDity_fd1_9'      >
        <button class='commoDity_fd1_9_c0'  @tap.stop="goPayFunc()" v-if= "dataDetails.is_use_score=='1'" >{{$t('立即兑换')}}</button><button class='commoDity_fd1_9_c0_1'  @tap.stop="goPayFunc()" v-if= "dataDetails.is_use_score=='0'" >积分不足</button>
</view>
    <view   class='flex flex-wrap align-center'      >
        </view>
</view>
        
<!---轮播flex布局结束-->
    
    
        </view>
    </view>
</template>
<script>
    import {validate} from '@/common/utils/validate.js'
    
    export default {
        components:{},
        
        
        data(){
			return {"bannerIndexfd1_0":0,"bannerIndexfd1_1_c0":0,"coupon":"0","integral":"500","sorts":[{"name":"精粹液","value":"1","image":""},{"name":"面霜","value":"2","image":""}],"sor":"1","milliliter":[{"name":"100ml","value":"1","image":""},{"name":"150ml","value":"2","image":""},{"name":"200ml","value":"3","image":""},{"name":"300ml","value":"4","image":""}],"ml":"1","dataDetails":{"name":"","thumb":"","integralcategory_name":"","images":[],"market_price":"","shop_price":"","integral":"","stock":"","description":"","body":"","status":"","sort":"","integralcategory_id":"","status_name":"","is_use_score":"","order_list":[]},"index":1,"address_id":"","dataAddress":[],"commodity_id":"8","id":"346"};
		},
		computed:{
            themeColor() {
              return this.$store.getters.themeColor
            },
                         isLogin() {
      return this.$store.state.token == '' ? false : true;
    },
              userInfo: {
      get() {
        return this.$store.state.userInfo
      },
      set() {
        this.$store.commit('updateUserInfo', value)
      },
    },
             isLogin() {
      return this.$store.state.token == '' ? false : true;
    }
		},
		watch:{},
		onLoad(options){
            let {commodity_id,id}=options
if (commodity_id !== undefined) this.commodity_id = commodity_id
if (id !== undefined) this.id = id
this.getDetailFunc()
this.getAddressFunc()
		},
        onUnload() {
                
        },
		onReady(){
            
		},
		onShow(){
            
		},
		onHide(){
            
		},
		onResize(){
            
		},
		onPullDownRefresh(){
            
		},
		onReachBottom(e){
            
		},
		onPageScroll(e){
            
		},
		methods:{
                            //跳转支付
                 goPayFunc(){
                        if( this.isLogin===true){
            if( this.dataDetails.is_use_score=='1'){
            this.$urouter.navigateTo(`/pages/jf/orderSure/orderSure?goods_id=${this.commodity_id}&address_id=${this.address_id}`);
    }
    }
    else{
                            uni.showToast({
                        title:global.i18n.t('请先登录'),
                        mask:true,
                        icon:'none',
                        duration: 1500
                    });
                this.toLoginDiy();
    }
                },
                //积分商城-积分商品详情
                async getDetailFunc(){
                        uni.showLoading({
title:'加载中'
})
    //请求方法
    //数据验证
    
  let datadataDetails = await this.$api.get(global.apiUrls.post6414599749e7f, {
    aid:this.commodity_id,user_id:this.userInfo.id
  });
  
  if (datadataDetails.data.code != 1) {
    this.$message.info(datadataDetails.data.msg);
    return
  } 
  let infodataDetails = datadataDetails.data;
  this.dataDetails = infodataDetails.data
  
    uni.hideLoading()
                },
                //获取默认地址
                async getAddressFunc(){
                        if( this.isLogin===true){
            //请求方法
    //数据验证
    
  let datadataAddress = await this.$api.get(global.apiUrls.post636f7683cf195, {
    
  });
  
  if (datadataAddress.data.code != 1) {
    this.$message.info(datadataAddress.data.msg);
    return
  } 
  let infodataAddress = datadataAddress.data.data;
  this.dataAddress = infodataAddress.data
  
     if (this.dataAddress) {
                        this.address_id = this.dataAddress[0].aid
						console.log(this.address_id);
                    }
    }
                }
		}
    };
</script> 
<style lang="scss" scoped>
           .page{
            width: 100vw;
            overflow-x: hidden;
            min-height: calc(100vh - var(--window-bottom));
            background:#fff;background-size: 100% auto;
        }
    .commoDity_flex_0{
        background:#fff;width:750rpx;height:88rpx;overflow:hidden;z-index:10;top:0rpx;background-size:100% auto !important;
    }
    .commoDity_fd0_0_c2{
        width:36rpx;
    }
    .commoDity_fd0_0_c0_c0{
        font-size:36rpx;font-weight:500;color:rgba(51, 51, 51, 1);
    }
    .commoDity_fd0_0{
        margin:0rpx 32rpx 0rpx 32rpx;line-height:88rpx;
    }
    .commoDity_flex_1{
        padding:0rpx 0rpx 32rpx 0rpx;position:relative;
    }
    .commoDity_fd1_9_c0_1{
        background:rgba(153, 153, 153, 1);border-radius:0rpx 0rpx 0rpx 0rpx;font-size:32rpx;color:#fff;width:750rpx;height:100rpx;line-height:100rpx;font-weight:500;
    }
    .commoDity_fd1_9_c0{
        background:var(--benbenbgColor7);border-radius:0rpx 0rpx 0rpx 0rpx;font-size:32rpx;color:#fff;width:750rpx;height:100rpx;line-height:100rpx;font-weight:500;
    }
    .commoDity_fd1_9{
        position:fixed;left:0rpx;bottom:calc(0rpx + var(--window-bottom));
    }
    ::v-deep .commoDity_fd1_8{
        width:686rpx;margin:0rpx 32rpx 120rpx 32rpx;
    }
    .commoDity_fd1_7_c0{
        font-size:36rpx;font-weight:700;color:rgba(26, 26, 26, 1);margin:32rpx 0rpx 24rpx 0rpx;
    }
    .commoDity_fd1_7{
        margin:0rpx 32rpx 15rpx 32rpx;
    }
    .commoDity_fd1_5_c1{
        font-size:28rpx;font-weight:400;color:rgba(51, 51, 51, 1);margin:0rpx 0rpx 0rpx auto;
    }
    .commoDity_fd1_5_c0{
        font-size:28rpx;font-weight:500;color:rgba(51, 51, 51, 1);
    }
    .commoDity_fd1_5{
        padding:32rpx 0rpx 32rpx 0rpx;margin:0rpx 32rpx 0rpx 32rpx;
    }
    .commoDity_fd1_4{
        background:var(--benbenbgColor5);background-size:100% auto !important;height:10rpx;
    }
    .commoDity_fd1_3_c4_1{
        background:rgba(153, 153, 153, 1);border-radius:28rpx 28rpx 28rpx 28rpx;width:148rpx;line-height:56rpx;font-size:24rpx;color:var(--benbenFontColor3);height:56rpx;margin:0rpx 0rpx 0rpx auto;
    }
    .commoDity_fd1_3_c4{
        background:var(--benbenbgColor7);border-radius:28rpx 28rpx 28rpx 28rpx;width:148rpx;line-height:56rpx;font-size:24rpx;color:#fff;height:56rpx;margin:0rpx 0rpx 0rpx auto;
    }
    .commoDity_fd1_3_c1_1{
        font-size:22rpx;font-weight:400;color:rgba(51, 51, 51, 1);line-height:28rpx;
    }
    .commoDity_fd1_3_c0{
        font-size:36rpx;font-weight:700;color:var(--benbenFontColor7);
    }
    .commoDity_fd1_3{
        margin:0rpx 32rpx 32rpx 32rpx;line-height:45rpx;
    }
    .commoDity_fd1_2{
        margin:32rpx 32rpx 32rpx 32rpx;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;font-size:32rpx;font-weight:500;color:rgba(51, 51, 51, 1);
    }
    .commoDity_numberfd1_1_c0_c0{
        background:#525050;position:absolute;bottom:20rpx;right:30rpx;width:80rpx;height:40rpx;border-radius:6rpx 6rpx 6rpx 6rpx;font-size:24rpx;color:#FFFFFF;line-height:46rpx;font-weight:400;
    }
    .commoDity_fd1_1_c0_c1{
        width:280rpx;height:46rpx;padding:0rpx 20rpx 0rpx 20rpx;
    }
    .commoDity_fd1_1_c0_c1_c1{
        color:var(--benbenFontColor3);font-size:24rpx;line-height:46rpx;
    }
    .commoDity_fd1_1_c0_c1_c0{
        color:var(--benbenFontColor3);font-size:24rpx;line-height:46rpx;width:50rpx;-webkit-line-clamp:1;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;
    }
    .commoDity_fd1_1_c0{
        width:280rpx;height:46rpx;
    }
    .commoDity_fd1_1{
        background:rgba(0, 0, 0, 0.39);position:absolute;top:652rpx;left:24rpx;width:290rpx;height:46rpx;background-size:100% auto;border-radius:24rpx;
    }
    .commoDity_numberfd1_0_c0_c2{
        font-size:26rpx;color:rgba(255, 255, 255, 1);line-height:46rpx;font-weight:400;
    }
    .commoDity_numberfd1_0_c0_c0{
        font-size:26rpx;color:#FFFFFF;line-height:46rpx;font-weight:400;
    }
    .commoDity_numberfd1_0_c0{
        background:rgba(0, 0, 0, 1);position:absolute;bottom:24rpx;right:32rpx;height:41rpx;border-radius:32rpx 32rpx 32rpx 32rpx;opacity:0.5;padding:5rpx 20rpx 5rpx 20rpx;
    }
    .commoDity_fd1_0_c1_c0{
        width:750rpx;height:750rpx;border-radius:0rpx 0rpx 0rpx 0rpx;
    }
    .commoDity_fd1_0{
        width:750rpx;height:750rpx;
    }
    .commoDity_swiperDotUnselectedfd1_0{
        border:1px solid rgba(0, 0, 0, 0.3);background:rgba(0, 0, 0, 0.3);width:16rpx;height:16rpx;border-radius:100rpx 100rpx 100rpx 100rpx;margin:0rpx 6rpx 0rpx 0rpx;font-size:24rpx;color:#fff;
    }
    .commoDity_swiperDotSelectedfd1_0{
        border:1px solid #00A7FF;background:#00A7FF;width:16rpx;height:16rpx;border-radius:100rpx 100rpx 100rpx 100rpx;margin:0rpx 6rpx 0rpx 0rpx;font-size:24rpx;color:#fff;
    }
    ::v-deep .commoDity_swiperDotfd1_0{
        position:absolute;bottom:20rpx;left:0rpx;right:0rpx;
    }
</style>